package proxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class MyMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object target, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("Before method: "+method.getName());
        Object retValue = methodProxy.invokeSuper(target, objects);
        System.out.println("After method: "+method.getName());
        return retValue;
    }
}
